package com.example.jobtask.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

/**
 * 热插拔任务配置类
 * 为热插拔任务提供必要的Bean
 */
@Configuration
public class HotPlugConfig {
    
    /**
     * RestTemplate Bean - 用于HTTP请求
     */
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
    
    /**
     * ObjectMapper Bean - 用于JSON处理
     * 如果已存在则不会重复创建
     */
    @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        // 支持Java 8时间类型
        mapper.registerModule(new JavaTimeModule());
        return mapper;
    }
}